<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- es6 class 就是es5 面向对象的 语法糖  -->
    <script>
        // 类中 包含了 构造函数 和 实例方法
        // 语法更清晰、更符合传统面向对象编程的方式来创建对象和实现继承
        class People {
            // 构造函数
            constructor( name , age , sex ){
                this.name = name
                this.age = age
                this.sex = sex
            }
            // 原型
            sing(){
                console.log(`唱歌`)
            }
        }
        // 继承-> 子继承父 -> extends -> 子类 extends 父类
        class Son extends People{
            constructor(address , job , name , age , sex){
                super(name , age , sex)  // 父类  调用父类的构造函数，super === 父类constructor
                this.address = address
                this.job = job
            }
            hobbiy(){
                console.log("玩耍")
            }
        }

        var s1 = new Son("北京" , "学生" , "李华" , 25 , "男")
        console.log(s1)
    </script>
</body>
</html>